package com.wistech.search.solr.extend;

import java.util.List;

/**
 * 文档处理管理器
 * 
 * @author Liuye
 * 
 */
public class DocumentHandlerManager {

	private List<DocumentHander> handlers;

	public void add(SolrIndexContext context) {
		if (handlers != null && !handlers.isEmpty()) {
			for (DocumentHander handler : handlers) {
				handler.add(context);
			}
		}
	}

	public boolean delete(String id) {
		if (handlers != null && !handlers.isEmpty()) {
			for (DocumentHander handler : handlers) {
				if (!handler.delete(id)) {
					return false;
				}
			}
		}
		return true;
	}

	/**
	 * @param handlers
	 *            the handlers to set
	 */
	public void setHandlers(List<DocumentHander> handlers) {
		this.handlers = handlers;
	}
}
